/*
* @Author: jack
* @Date:   2019-12-17 12:26:06
* @Last Modified by:   jack
* @Last Modified time: 2020-04-27 09:22:12
*/
import Vue from 'vue'
import Router from 'vue-router'
import store from '@/store'
Vue.use(Router)
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

let app = new Router({
  base: process.env.PATH,
  routes: [
    {
      path: '/',
      name: 'Index',
      component: () => import('@/pages/home'),
      meta: {
        requiresAuth: true,
        title: store.state.acc.title
      }
    },
    {
      path: '/clear',
      name: 'clear',
      component: () => import('@/pages/clear'),
    },
    {
      path: '/view',
      name: 'DatiView',
      meta: {
        requiresAuth: true,
        title: store.state.acc.title
      },
      component: () => import('@/pages/dati'),
    },
    {
      path: '/result/:id',
      name: 'DatiResult',
      meta: {
        requiresAuth: true,
        title: store.state.acc.title
      },
      component: () => import('@/pages/result'),
    },
    {
      path: '/rank',
      name: 'DatiRank',
      meta: {
        requiresAuth: true,
        title: store.state.acc.title + '-排行榜'
      },
      component: () => import('@/pages/rank'),
    },
    {
      path: '/redbag',
      name: 'DatiRebbag',
      meta: {
        requiresAuth: true,
        orRequiresAuth: true,
        title: store.state.acc.title + '-红包'
      },
      component: () => import('@/pages/redbag'),
    }
  ]
})

let index = app

export default index

